<template>
  <div class="main" @touchmove.prevent v-show="show">
    <div class="dialog">
      <div class="title">
        {{ title }}
      </div>
      <div class="content">
        <slot></slot>
      </div>
      <iule-button @click="close()" size="full"  height="1rem">{{ buttonText }}</iule-button>
    </div>
  </div>
</template>

<script>
import IuleButton from './iule-button'
export default {
  name: 'iule-dialog',
  model: {
    prop: 'show'
  },
  components: {
    IuleButton
  },
  props: {
    buttonText: {
      type: String,
      default: '确定'
    },
    show: {
      type: Boolean,
      default: true
    },
    title: {
      type: String,
      default: ''
    }
  },
  created () {
  },
  methods: {
    close () {
      this.$emit('input', false)
      this.$emit('click')
    }
  }
}
</script>

<style scoped>
  .content {
    font-size: 0.36rem;
    color: rgba(51, 51, 51, 1);
    width: 90%;
    margin: 0.5rem auto 1rem;
  }
  .title {
    width: 100%;
    text-align: center;
    font-size:0.44rem;
    font-weight:500;
    color:rgba(0,0,0,1);
    line-height:0.67rem;
    margin-bottom: 0.2rem;
  }
  .dialog {
    position: fixed;
    padding: 0.5rem;
    top: 45%;
    left: 50%;
    width: 80%;
    overflow: hidden;
    font-size:0.36rem;
    background-color: #fff;
    border-radius:0.17rem;
    -webkit-transform: translate3d(-50%, -50%, 0);
    transform: translate3d(-50%, -50%, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transition: 0.3s;
    transition: 0.3s;
    -webkit-transition-property: opacity, -webkit-transform;
  }
  .main{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999;
    pointer-events: visiblePainted;
  }
</style>
